package com.example.dayu521.msg_sender.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface LockMapper {
    @Select("select count(*) from  sms_lock_test where id=0 for update")
    int lock_tb_sms();

    @Select("select version from  sms_lock_test where id=0")
    long get_lock_version();

    @Update("update sms_lock_test set version=#{version}+1 where id=0 and version=#{old_version}")
    int update_lock_version(@Param("old_version") long old_version);
}
